Skip to content

Conversation

@sbomer
Copy link
Member

@sbomer sbomer commented Oct 30, 2025

  • Enables building native AOT smoke tests for android with one APK per test project
  • Adds marker files to set expected exit code when running through helix
  • Adds a runtime-androidemulator job for native AOT smoke tests
  • Expands libraries test coverage to include non-smoke tests
  • Sets up appcontext base directory in test host
  • Calls managed main through a pinvoke when running Exe project in the runtime tests

Fixes #120715

sbomer added 30 commits October 13, 2025 17:21
- Expand native AOT smoke tests to all libraries tests - Add job for
runtime smoke tests using native AOT on emulator
Move NDK compiler logic to a shared props file and import it in test and
build projects to unify Android NativeAOT and Mono builds.
- Set ASSETS_DIR for crypto tests
  (using same pattern as existing crypto test)
- Set AppContext.BaseDirectory

We should probably change crypto tests to use
just AppContext.BaseDirectory.
- Use ReferenceXUnitWrapperGenerator != false to define SINGLE_FILE_TEST_RUNNER (android & singlefile targets) instead of IsFunctionalTest
- Condition SingleFileTestRunner compile and TrimmerRootAssembly (TestUtilities) on wrapper/generator and SkipTestUtilitiesReference
- Add Android NativeAOT publish/trim settings and set NativeLib/CustomNativeMain for android nativeaot
- Make DisableImplicitFrameworkReferences respect preexisting value and add explicit DisableImplicitFrameworkReferences=false in nativeaot tests dir
- Import testing\tests.targets when TargetsAndroid is true
- Update many NativeAOT smoke tests Main signatures to public static int Main(string[] args) to match runner invocation
- Ensure they have Main entry point
- Tighten MSBuild conditions:
  - Only set NativeLib/CustomNativeMain for Android when OutputType == Exe
  - Only import testing/tests.targets for Android when using MicrosoftNETSdk and building executables
  - Make TestNativeAOT/UseNativeAOTRuntime defaults apply when TestBuildMode == nativeaot and only include monodroid-nativeaot.cs for executable/XUnit-wrapper cases
- Avoid importing logic for SharedLibrary
- Fix library filename
- Set HasMergedInTests to ensure projects build
This import is now covered by the IsMergedTestRunnerAssembly property.
Fixes a warning about a double import.
Fixes issue where mono runtime tests are getting incorrect assembly name
due to this undesired import.
@sbomer
Copy link
Member Author

sbomer commented Nov 10, 2025

/azp run runtime-androidemulator

@sbomer
Copy link
Member Author

sbomer commented Nov 10, 2025

/azp run runtime-android

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but I don't know anything about xharness or android testing. Would be nice if someone else who knows about those could look at it from that angle.

return path + Path.DirectorySeparatorChar;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave this in?

@MichalStrehovsky
Copy link
Member

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

- Fix left-over whitespace change
- Remove unnecessary ClrTestTargetUnsupported condition
@sbomer
Copy link
Member Author

sbomer commented Nov 13, 2025

/azp run runtime-android

@sbomer
Copy link
Member Author

sbomer commented Nov 13, 2025

/azp run runtime-androidemulator

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

1 similar comment
@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sbomer
Copy link
Member Author

sbomer commented Nov 13, 2025

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sbomer
Copy link
Member Author

sbomer commented Nov 13, 2025

@simonrozsival @jtschuster you've both touched the android test infrastructure, I'd appreciate another review from one of you if you get a chance!

Copy link
Member

@jtschuster jtschuster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@sbomer
Copy link
Member Author

sbomer commented Nov 17, 2025

/azp run runtime-androidemulator

@sbomer
Copy link
Member Author

sbomer commented Nov 17, 2025

/azp run runtime-android

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NAOT][android] Microsoft.Extensions.Hosting.Unit.Tests failure

6 participants